/*
 * @Author: zheng yong tao
 * @Date: 2022-01-03 23:49:28
 * @LastEditors: zheng yong tao
 * @LastEditTime: 2022-01-04 00:10:53
 * @Description: 
 */

const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');

app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:false}));

app.all('*',(req,res,next)=>{
    let login = true;
    if(!login) {    
        console.log(login);
        return res.json('未登录');
    }
    next();
})

app.get('/',(req,res)=>{
    res.json('helloWorld');
})

//配置服务端口
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
    console.log('blog listening at http://%s:%s', host, port);
})